package 备忘录模式;

public class main {
    public static void main(String[] args) {
        //创建原始类
        Original original = new Original("张三");
        //创建备忘录
        Storage storage = new Storage(original.createMemento());
        //修改原始类的状态
        System.out.println("原数据:"+original.getValue());
        original.setValue("李四");
        System.out.println("原数据:"+original.getValue());
        //恢复
        original.restoreMemento(storage.getMemento());
        System.out.println("原数据恢复:"+original.getValue());
    }
}
